package com.cctc.rds.raft.core.rpc.log;

import com.cctc.rds.raft.core.log.Log;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LogRpcRequest implements Cloneable {
    private int nodeId;
    private long term;
    private long lastCommitLogIndex;
    private long lastCommitLogTerm;
    private long followerCommitLogIndex;
    private Log[] logs;

    @Override
    protected LogRpcRequest clone() throws CloneNotSupportedException {
        return LogRpcRequest.builder()
                .nodeId(nodeId)
                .term(term)
                .lastCommitLogIndex(lastCommitLogIndex)
                .lastCommitLogTerm(lastCommitLogTerm)
                .followerCommitLogIndex(followerCommitLogIndex)
                .build();
    }

}
